home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Drawing / Clipper.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  2.1 KB  |  70 lines  |  [TEXT/CWIE]

  1. // Clipper.h
  2.  
  3. #ifndef Clipper_h
  4. #define Clipper_h
  5.  
  6. #ifndef RegionObject_h
  7. #include "RegionObject.h"
  8. #endif
  9.  
  10. class Clipper
  11.   {
  12.     private:
  13.         RegionObject saved;
  14.         RegionObject current;
  15.         
  16.         void Clip()        { SetClip( current ); }
  17.         
  18.     public:
  19.         Clipper();
  20.         Clipper( RgnHandle );
  21.         Clipper( const Rect& );
  22.         Clipper( const Clipper& );
  23.         
  24.         ~Clipper();
  25.         
  26.         void BeEmpty();
  27.         void Restore();
  28.         
  29.         void operator=( const Rect& r );
  30.         void operator=( RgnHandle r );
  31.         void operator=( const Clipper& r );
  32.         
  33.         void operator&=( const Rect& r );
  34.         void operator-=( const Rect& r );
  35.         
  36.         void operator&=( RgnHandle r );
  37.         void operator-=( RgnHandle r );
  38.  
  39.         void Inset( int16 amount );
  40.         void Inset( Point amount );
  41.         
  42.         Rectangle Bounds() const                            { return current.Bounds(); }
  43.         operator const RegionObject&() const            { return current; }
  44.         operator RgnHandle() const                            { return current; }
  45.         const RegionObject& Region() const                { return current; }
  46.         
  47.         bool IsEmpty() const                                    { return current.IsEmpty(); }
  48.         bool Contains( Point p ) const                    { return current.Contains( p ); }
  49.         bool Rectangular() const                            { return current.Rectangular(); }
  50.  
  51.         bool Intersects( const Rect& r ) const            { return current.Intersects( r ); }
  52.         bool Intersects( const RgnHandle r ) const    { return current.Intersects( r ); }
  53.         
  54.         bool operator==( const Rect& r ) const            { return current == r; }
  55.         bool operator!=( const Rect& r ) const            { return current != r; }
  56.         bool operator<=( const Rect& r ) const            { return current <= r; }
  57.         bool operator>=( const Rect& r ) const            { return current >= r; }
  58.         bool operator<( const Rect& r ) const            { return current < r; }
  59.         bool operator>( const Rect& r ) const            { return current > r; }
  60.         
  61.         bool operator==( RgnHandle r ) const            { return current == r; }
  62.         bool operator!=( RgnHandle r ) const            { return current != r; }
  63.         bool operator<=( RgnHandle r ) const            { return current <= r; }
  64.         bool operator>=( RgnHandle r ) const            { return current >= r; }
  65.         bool operator<( RgnHandle r ) const                { return current < r; }
  66.         bool operator>( RgnHandle r ) const                { return current > r; }
  67.   };
  68.  
  69. #endif
  70.